package com.wd.live.view.adpater;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.wd.live.R;
import com.wd.live.bean.FindConstellationBean;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

/**
 * <p>项目名称:LookFor2.0</p>
 * <p>包名:com.wd.live.view.adpater</p>
 * <p>简述:</p>
 *
 * @author 孟令高
 * @date 2022/11/11
 */
public class XingzuoAdpater extends CommonAdapter<FindConstellationBean.ResultBean> {

    public XingzuoAdpater(Context context, int layoutId, List<FindConstellationBean.ResultBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, FindConstellationBean.ResultBean resultBean, int position) {
        TextView name = holder.getView(R.id.name);
        name.setText(resultBean.getNickName());
        ImageView xingzuo = holder.getView(R.id.xinzuo);
        RoundedCorners roundedCorners = new RoundedCorners(30);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(holder.itemView.getContext())
                .load(resultBean.getConstellationImage())
                .apply(RequestOptions.bitmapTransform(new CircleCrop()))
                .into(xingzuo);
        Glide.with(holder.itemView.getContext())
                .load(resultBean.getPersonalImage())
                .apply(RequestOptions.bitmapTransform(new RoundedCorners(200)))
                .into((ImageView) holder.getView(R.id.img));
        if(resultBean.getSex()==1){
            ImageView sex = holder.getView(R.id.sex);
            sex.setImageResource(R.mipmap.nanren);
        }else {
            ImageView sex = holder.getView(R.id.sex);
            sex.setImageResource(R.mipmap.woman);
        }
    }
}
